package huawei.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import huawei.graphics.drawable.HwLoadingDrawableImpl;
import huawei.hwanimation.CubicBezierInterpolator;
import o.fqg.b;
import o.fqg.e;

public class HwProgressBar extends ProgressBar {
    private static final int DEFAULT_COLOR = -11711155;
    private static final float INTERPOLATOR_CONTROL_X1 = 0.38f;
    private static final float INTERPOLATOR_CONTROL_X2 = 0.0f;
    private static final float INTERPOLATOR_CONTROL_Y1 = 0.1f;
    private static final float INTERPOLATOR_CONTROL_Y2 = 0.93f;
    private int mFillColor;

    public HwProgressBar(Context context) {
        super(context);
        initialize(context, null, 0);
    }

    public HwProgressBar(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        initialize(context, attributeSet, 0);
    }

    public HwProgressBar(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        initialize(context, attributeSet, i);
    }

    private void initialize(Context context, AttributeSet attributeSet, int i) {
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, e.ˏ, i, b.ˏ);
        this.mFillColor = obtainStyledAttributes.getColor(e.ˎ, DEFAULT_COLOR);
        obtainStyledAttributes.recycle();
        if (!isInEditMode()) {
            initEmuiStyle();
        }
    }

    private void initEmuiStyle() {
        setIndeterminateDrawable(new HwLoadingDrawableImpl(getResources(), getMinimumWidth() > getMinimumHeight() ? getMinimumHeight() : getMinimumWidth(), this.mFillColor));
        setInterpolator(new CubicBezierInterpolator(INTERPOLATOR_CONTROL_X1, 0.1f, INTERPOLATOR_CONTROL_X2, INTERPOLATOR_CONTROL_Y2));
    }
}
